<?php
/**
*	Setup Page side bar
**/
if ( function_exists('register_sidebar') )
	    register_sidebar(
      		array(        
      		  'name' => esc_html__( 'Page Sidebar', 'TT' ),
              'description' => esc_html__( 'This is land of page sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'
			 )
      		);
    
/**
*	Setup Contact side bar
**/
if ( function_exists('register_sidebar') )
    register_sidebar(
	array(        
      		  'name' => esc_html__( 'Contact Sidebar', 'TT' ),
              'description' => esc_html__( 'This is land of Contact sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'
			 )
      		);
    
/**
*	Setup Blog side bar
**/
if ( function_exists('register_sidebar') )
    register_sidebar(
		array(        
      		  'name' => esc_html__( 'Blog Sidebar', 'TT' ),
              'description' => esc_html__( 'This is land of Blog sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'
			 )
      		);
 if ( function_exists('register_sidebar') )
    register_sidebar(
		array(        
      		  'name' => esc_html__( 'Home Sidebar', 'TT' ),
              'description' => esc_html__( 'This is land of Blog sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'
			 )
      		);
    

/**
*	Setup Portfolio side bar
**/
if ( function_exists('register_sidebar') )
	    register_sidebar(
      		array(        
      		  'name' => esc_html__( 'Portfolio Sidebar', 'TT' ),
              'description' => esc_html__( 'This is land of page sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'
			 )
      		);
    
//Register dynamic sidebar
$ds = get_theme_option('general','add_custom_sidebar');
$dynamic_sidebar = explode(",",$ds);

if(!empty($dynamic_sidebar))
{
	foreach($dynamic_sidebar as $sidebar)
	{
		if ( function_exists('register_sidebar') && ($sidebar <> ''))
	    register_sidebar(array('name' => str_replace("_"," ",$sidebar),
              'description' => esc_html__( 'This is land of page sidebar','TT' ),
              'before_widget' => '<div class="sidebar-box">',
              'after_widget' => '</div><div class="clearfix"></div>',
              'before_title' => '<h3><span>',
              'after_title' => '</span></h3>'		
		
		));
	}
}



?>